import { StatusFilterDto } from './dto/status-filter.dto';
import { TaskStatusValidationPipe } from './pipes/task-status-validation.pipe';
import { TasksService } from './tasks.service';
import {
  Body,
  Controller,
  Delete,
  Get,
  Logger,
  Param,
  ParseIntPipe,
  Post,
  Put,
  Query,
  UsePipes,
  ValidationPipe,
} from '@nestjs/common';
import CreateTaskDto from './dto/create-task.dto';
import UpdateTaskDto from './dto/update-task.dto';
import { Task } from './task.entity';
import { TaskStatus } from './task-status.enum';

@Controller('tasks')
export class TasksController {
  constructor(private tasksService: TasksService) {
  
    
  }
 
  @Get('/:id')
  getTaskById(@Param('id', ParseIntPipe) id: number): Promise<Task>|1 {
    // return this.tasksService.getTaskById(id);
    console.log('123');
    
    return 1;
  }
  // @Get()
  // getAllTasks(@Query(ValidationPipe) filter: StatusFilterDto): Task[] {
  //   const tasks = this.tasksService.getAllTasks(filter);
  //   return tasks;
  // }
  @Post()
  @UsePipes(ValidationPipe)
  createTask(@Body() creatTaskDto: CreateTaskDto): Promise<Task> {
    return this.tasksService.createtask(creatTaskDto);
  }
  // @Get('/:id') getTaskById(@Param('id') id: string) {
  //   return this.tasksService.getTaskById(id);
  // }
  // @Delete('/:id') deleteTaskById(@Param('id') id: string) {
  //   return this.tasksService.deleteTaskById(id);
  // }
  // @Put('/:id') updateTaskById(
  //   @Param('id') id: string,
  //   @Body() newTask: UpdateTaskDto,
  // ) {
  //   return this.tasksService.updateTaskById(id, newTask);
  // }
  // @Put('/stauts-change/:id') updateTaskStatusById(
  //   @Param('id') id: string,
  //   @Body('status', TaskStatusValidationPipe) status: TaskStatus,
  // ) {
  //   return this.tasksService.updateStatusById(id, status);
  // }
}
